package cn.mf.eureka.client;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author cityre
 * @date 2019/3/4
 */
@RestController
@Slf4j
public class HelloController {
	
	private final DiscoveryClient discoveryClient;
	
	@Autowired
	public HelloController(DiscoveryClient discoveryClient) {
		this.discoveryClient = discoveryClient;
	}
	
	@GetMapping("/hello")
	public String hello() {
		String services = "Services: " + discoveryClient.getServices();
		log.info(services);
		return services;
	}
	
	
}
